using GroupSix.Domain.Events;

namespace GroupSix.Infrastructure.Events;

/// <summary>
/// 领域事件分发器实现
/// </summary>
public class DomainEventDispatcher : IDomainEventDispatcher
{
    private readonly IServiceProvider _serviceProvider;

    public DomainEventDispatcher(IServiceProvider serviceProvider)
    {
        _serviceProvider = serviceProvider;
    }

    public async Task DispatchAsync(IDomainEvent domainEvent)
    {
        // 这里可以实现事件处理器注册和分发逻辑
        // 目前只是简单的日志记录
        Console.WriteLine($"Domain event dispatched: {domainEvent.GetType().Name} at {domainEvent.OccurredOn}");
        
        await Task.CompletedTask;
    }
} 